package com.erp.Struts.Action;

import java.util.List;

import com.erp.Struts.common.Pager;
import com.erp.hibernate.beans.Inbill;
import com.erp.hibernate.beans.Saleorderform;
import com.erp.hibernate.beans.Stockorderform;
import com.erp.hibernate.dao.InbillDAO;
import com.erp.hibernate.dao.OutbillDAO;
import com.erp.hibernate.dao.SaleorderformDAO;
import com.erp.hibernate.dao.StockorderformDAO;
import com.erp.hibernate.dao.StorageDAO;

public class SearchAction extends PageAction {

	private static final long serialVersionUID = 4079088059353820036L;
	private InbillDAO inbillDAO;
	private OutbillDAO outbillDAO;
	private StorageDAO storageDAO;
	private SaleorderformDAO saleorderformDAO;
	private StockorderformDAO stockorderformDAO;
	private Saleorderform saleorderform;
	private Stockorderform stockorderform;
	private Inbill inbill;
	private String dir;
	private String goodsId;
	private String type;
	private String value;

	public String findbill() throws Exception{
		List billList = this.getInbillDAO().findByGoodsid(goodsId);
		if(billList.size()!=0){
			inbill = (Inbill)billList.get(0);
		}
		return dir;
	}
	
	public String incon() throws Exception{
		List result = this.getInbillDAO().findByProperty(type, value);
		super.pager = new Pager(pageSize, pageNo, result.size(), result);
		return "inbillcondition";
	}
	
	public String outcon() throws Exception{
		List result = this.getOutbillDAO().findByProperty(type, value);
		super.pager = new Pager(pageSize, pageNo, result.size(), result);
		return "outbillcondition";
	}
	
	public String storcon() throws Exception{
		List result = this.getStorageDAO().findByProperty(type, value);
		super.pager = new Pager(pageSize, pageNo, result.size(), result);
		return "storagecondition";
	}
	
	public String salequery() throws Exception{
		List result = this.getSaleorderformDAO().findByProperty(type, value);
		super.pager = new Pager(pageSize, pageNo, result.size(), result);
		return "salequery";
	}
	
	public String stockquery() throws Exception{
		List result = this.getStockorderformDAO().findByProperty(type, value);
		super.pager = new Pager(pageSize, pageNo, result.size(), result);
		return "stockquery";
	}

	public InbillDAO getInbillDAO() {
		return inbillDAO;
	}

	public void setInbillDAO(InbillDAO inbillDAO) {
		this.inbillDAO = inbillDAO;
	}

	public OutbillDAO getOutbillDAO() {
		return outbillDAO;
	}

	public void setOutbillDAO(OutbillDAO outbillDAO) {
		this.outbillDAO = outbillDAO;
	}

	public StorageDAO getStorageDAO() {
		return storageDAO;
	}

	public void setStorageDAO(StorageDAO storageDAO) {
		this.storageDAO = storageDAO;
	}
	
	public SaleorderformDAO getSaleorderformDAO() {
		return saleorderformDAO;
	}

	public void setSaleorderformDAO(SaleorderformDAO saleorderformDAO) {
		this.saleorderformDAO = saleorderformDAO;
	}

	public StockorderformDAO getStockorderformDAO() {
		return stockorderformDAO;
	}

	public void setStockorderformDAO(StockorderformDAO stockorderformDAO) {
		this.stockorderformDAO = stockorderformDAO;
	}

	public Saleorderform getSaleorderform() {
		return saleorderform;
	}

	public void setSaleorderform(Saleorderform saleorderform) {
		this.saleorderform = saleorderform;
	}

	public Stockorderform getStockorderform() {
		return stockorderform;
	}

	public void setStockorderform(Stockorderform stockorderform) {
		this.stockorderform = stockorderform;
	}

	public Inbill getInbill() {
		return inbill;
	}

	public void setInbill(Inbill inbill) {
		this.inbill = inbill;
	}

	public String getDir() {
		return dir;
	}

	public void setDir(String dir) {
		this.dir = dir;
	}

	public String getGoodsId() {
		return goodsId;
	}

	public void setGoodsId(String goodsId) {
		this.goodsId = goodsId;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}
}
